<template>
  <div class="prodInfo">
    <div class="tab-list flex-a">
      <div :class="tab == item.value ? 'active item' : 'item'" v-for="item in tabList" :key="item.value"
        @click="changeTab(item.value)">
        <span>{{ item.name }}</span>
        <i></i>
      </div>
    </div>
    <div class="box">
      <!-- 商品管理 -->
      <div v-if="tab == 'ssgl'" class="flex">
        <!-- 左侧---商品分类 -->
        <div class="left">
          <div class="tree-head">
            <el-button type="warning" class="btn" @click="addSort">新建分类</el-button>
            <!-- <el-button type="warning" class="btn-plain">排序</el-button> -->
          </div>
          <div class="tree-sort">
            <div :class="sort == 'all' ? 'active' : ''" @click="changeSort('all')">全部分类</div>
            <div :class="sort == 'none' ? 'active' : ''" @click="changeSort('none')">未分类</div>
          </div>
          <div class="tree-list-box">
            <div class="tree-content overflow-y-auto">
              <el-tree class="el--tree-dom" ref="treeDom" :data="treeObjdata" node-key="id" 
                @node-drag-start="handleDragStart" @node-drag-enter="handleDragEnter" @node-drag-leave="handleDragLeave"
                @node-drag-over="handleDragOver" @node-drag-end="handleDragEnd" @node-drop="handleDrop"
                :filter-node-method="filterTreeNode" draggable :allow-drop="allowDrop" :allow-drag="allowDrag"
                :expand-on-click-node='false'>
                <div class="custom-tree-node" slot-scope="{data,node}" @click="treeNodeClick(data, node)">
                  <div class="custom-show-data" v-if="!data.isEdit">
                    <div class="custom-node-label" :class="{ 'no-group-label': !data.isGroup }">
                      {{ node.label }}
                    </div>
                    <!-- v-if="data.isGroup" -->
                    <template>
                      <!-- v-show="!ishaveEdit && data.isGroup != 9527" -->
                      <div class="cust-label-oper">
                        <i class="el-icon-circle-plus-outline" @click="addGroupTree(data)" v-show="data.children"></i>
                        <i class="el-icon-edit" @click="editGroupTree(data, node)"></i>
                        <i class="el-icon-close" @click="removeGroupTree(data, node)"></i>
                      </div>
                    </template>
                  </div>
                  <div class="custom-edit-node" v-else>
                    <input class="custon-edit-input" size="mini" v-model="editNodeVal" @keydown.enter="eidtClass"
                      placeholder="请输入分组名称" />
                    <div class="custon-edit-ico">
                      <i class="iconfont wh-icon-tick" @click="editTreeNodeSave(data, node)"></i>
                      <i class="iconfont wh-icon-delete" @click="editTreeNodeCancel(data, node)"></i>
                    </div>
                  </div>
                </div>
              </el-tree>
            </div>
          </div>
        </div>
        <!-- 右侧---商品列表 -->
        <div class="right">
          <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch"
            class="flex-a input" label-width="68px">
            <el-form-item>
              <el-select v-model="queryParams.datProdInfocol" clearable placeholder="请选择供应商">
                <el-option v-for="item in suppLiserList" :key="item.value" :label="item.supName" :value="item.value + ''">
                </el-option>
              </el-select>
            </el-form-item>
            <el-form-item prop="name" class="input">
              <el-input v-model="queryParams.name" placeholder="请输入商品名称/品牌/条形码" clearable
                @keyup.enter.native="handleQuery" />
            </el-form-item>
            <el-form-item>
              <el-button type="primary" size="mini" class="btn" @click="handleQuery">查询</el-button>
              <el-button type="primary" class="btn" size="mini" @click="addProd"
                v-hasPermi="['pet:prodInfo:add']">新增商品</el-button>
              <!-- <el-button type="warning" size="mini" class="btn" @click="handleExport"
                v-hasPermi="['pet:prodInfo:export']">导入</el-button> -->
              <el-button type="warning" size="mini" class="btn" @click="handleExport"
                v-hasPermi="['pet:prodInfo:export']">导出</el-button>
            </el-form-item>
          </el-form>
          <el-table :data="prodInfoList" @selection-change="handleSelectionChange">
            <el-table-column type="selection" width="55" align="center" />
            <el-table-column label="商品图片" align="center" prop="url">
              <template slot-scope="scope">
                <img :src="scope.row.url" style="width: 30%;" alt="">
              </template>
            </el-table-column>
            <el-table-column label="商品信息" align="center" prop="name" />
            <el-table-column label="品牌" align="center" prop="brand" />
            <el-table-column label="零售价(元)" align="center" prop="retPrice" />
            <el-table-column label="会员价(元)" align="center" prop="memPrice" />
            <el-table-column label="库存量" align="center" prop="alert" />
            <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
              <template slot-scope="scope">
                <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
                  v-hasPermi="['pet:prodInfo:edit']">编辑</el-button>
                <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
                  v-hasPermi="['pet:prodInfo:remove']">删除</el-button>
              </template>
            </el-table-column>
          </el-table>
          <div class="table-foot flex-a flex-b">
            <div class="flex-a">
              <div style="color:#606266">
                <el-checkbox v-model="check" @change="checkedAll(prodInfoList[1], prodInfoList[2])"></el-checkbox>当页全选
              </div>
              <div>
                <el-dropdown class="dropdown" placement="bottom" @command="handleCommand" style="top:0;left:20px" >
                  <span class="el-dropdown-link">
                    批量操作<i class="el-icon-arrow-down el-icon--right"></i>
                  </span>
                  <el-dropdown-menu slot="dropdown">
                    <el-dropdown-item v-for="item in operationList" :key="item.value" :command="item.value">{{
                      item.label
                    }}</el-dropdown-item>
                  </el-dropdown-menu>
                </el-dropdown>
              </div>
            </div>
            <pagination :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
              @pagination="getList" />
          </div>
        </div>
      </div>
      <!-- 品牌管理 -->
      <div v-if="tab == 'ppgl'">
        <brand></brand>
      </div>
      <!-- 供应商管理 -->
      <div v-if="tab == 'gysgl'">
        <supplier></supplier>
      </div>
    </div>
    <!-- 新增分类弹窗 -->
    <el-dialog title="新增分类" :visible.sync="sortDialogVisible" width="25%" class="center">
      <el-form :model="sortForm" :rules="sortRules">
        <el-form-item label="分类名称" label-width="100px" prop="name" class="input">
          <el-input v-model="sortForm.name" autocomplete="off" placeholder="请输入分类名称（建议 5 字以内）"></el-input>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button class="btn" style="padding:12px 70px" @click="submitClass">提 交</el-button>
      </span>
    </el-dialog>
    <!-- 添加或修改商品信息对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="商品编号" prop="no">
          <el-input v-model="form.no" placeholder="请输入商品编号" />
        </el-form-item>
        <el-form-item label="商品名称" prop="name">
          <el-input v-model="form.name" placeholder="请输入商品名称" />
        </el-form-item>
        <el-form-item label="一级分类" prop="topCate">
          <el-input v-model="form.topCate" placeholder="请输入一级分类" />
        </el-form-item>
        <el-form-item label="二级分类" prop="sedCate">
          <el-input v-model="form.sedCate" placeholder="请输入二级分类" />
        </el-form-item>
        <el-form-item label="品牌" prop="brand">
          <el-input v-model="form.brand" placeholder="请输入品牌" />
        </el-form-item>
        <el-form-item label="保质期" prop="datProdInfocol">
          <el-input v-model="form.datProdInfocol" placeholder="请输入保质期" />
        </el-form-item>
        <el-form-item label="保质期" prop="sellByDate">
          <el-input v-model="form.sellByDate" placeholder="请输入保质期" />
        </el-form-item>
        <el-form-item label="条形码" prop="barCode">
          <el-input v-model="form.barCode" placeholder="请输入条形码" />
        </el-form-item>
        <el-form-item label="规格型号" prop="spetModel">
          <el-input v-model="form.spetModel" placeholder="请输入规格型号" />
        </el-form-item>
        <el-form-item label="单位" prop="unit">
          <el-input v-model="form.unit" placeholder="请输入单位" />
        </el-form-item>
        <el-form-item label="进货价" prop="buyPrice">
          <el-input v-model="form.buyPrice" placeholder="请输入进货价" />
        </el-form-item>
        <el-form-item label="零售价" prop="retPrice">
          <el-input v-model="form.retPrice" placeholder="请输入零售价" />
        </el-form-item>
        <el-form-item label="会员价" prop="memPrice">
          <el-input v-model="form.memPrice" placeholder="请输入会员价" />
        </el-form-item>
        <el-form-item label="是否支持负库存销售  0-否 1-是" prop="isNoModel">
          <el-input v-model="form.isNoModel" placeholder="请输入是否支持负库存销售  0-否 1-是" />
        </el-form-item>
        <el-form-item label="库存预警数" prop="alert">
          <el-input v-model="form.alert" placeholder="请输入库存预警数" />
        </el-form-item>
        <el-form-item label="是否参与会员打折" prop="isDisMem">
          <el-input v-model="form.isDisMem" placeholder="请输入是否参与会员打折" />
        </el-form-item>
        <el-form-item label="是否复购提醒" prop="isPrchRem">
          <el-input v-model="form.isPrchRem" placeholder="请输入是否复购提醒" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { supplierSelectList } from "@/api/pet/supplier"
import { listProdInfo, getProdInfo, delProdInfo, addProdInfo, updateProdInfo } from "@/api/pet/prodInfo";
import { getClassList, addClassInfo, updateClass, delClass } from "@/api/pet/class"
import brand from './../brand/index'
import supplier from './../supplier/index'
export default {
  name: "ProdInfo",
  components: { brand, supplier },
  data() {
    return {
      tab: 'ssgl',
      tabList: [
        {
          name: '商品管理',
          value: 'ssgl'
        },
        {
          name: '品牌管理',
          value: 'ppgl'
        },
        {
          name: '供应商管理',
          value: 'gysgl'
        }
      ],
      sort: '',
      supplierList: [],//供应商下拉列表
      check: false,
      operationList: [
        // {
        //   label: '批量入库',
        //   value: '1'
        // },
        // {
        //   label: '修改分类',
        //   value: '2'
        // },
        // {
        //   label: '修改零售价',
        //   value: '3'
        // },
        // {
        //   label: '修改会员价',
        //   value: '4'
        // },
        // {
        //   label: '是否支持负库存销售',
        //   value: '5'
        // },
        // {
        //   label: '是否开启库存预警',
        //   value: '6'
        // },
        // {
        //   label: '是否开启会员打折',
        //   value: '7'
        // },
        // {
        //   label: '是否开启复购提醒',
        //   value: '8'
        // },
        // {
        //   label: '修改品牌',
        //   value: '9'
        // },
        {
          label: '删除',
          value: '10'
        }
      ],//批量操作
      operation: '',
      sortDialogVisible: false,//新增分类弹窗
      sortForm: {},
      sortRules: {
        name: [
          { required: true, message: '请输入分类名称', trigger: 'blur' }
        ],
      },
      filterText: "",
      // S tree 节点操作相关
      // 是否有节点在编辑中
      ishaveEdit: false,
      editNodeVal: "",
      // S tree 节点操作相关
      treeObjdata: [
        {
          id: 0,
          label: '其他',
          isEdit: false,//节点编辑
          isGroup: true,
          children: [{
            id: 5564564564656,
            label: '其他',
            isEdit: false,//节点编辑
            isGroup: false,
          }]
        }, {
          id: 1,
          label: '药品',
          isEdit: false,//节点编辑
          isGroup: true,
          children: [{
            id: 4,
            label: '小宠药品',
            isEdit: false,//节点编辑
            isGroup: true,
          },
          {
            id: 5,
            label: '驱虫',
            isEdit: false,//节点编辑
            isGroup: true,
          }, {
            id: 6,
            label: '疫苗',
            isEdit: false,//节点编辑
            isGroup: true,
          }, {
            id: 7,
            label: '其他药品',
            isEdit: false,//节点编辑
            isGroup: true,
          }, {
            id: 8,
            label: '内用药',
            isEdit: false,//节点编辑
            isGroup: true,
          }, {
            id: 9,
            label: '外用药',
            isEdit: false,//节点编辑
            isGroup: true,
          }]
        }, {
          id: 2,
          label: '食品',
          isEdit: false,//节点编辑
          isGroup: true,
          children: [{
            id: 10,
            label: '小宠食品',
            isEdit: false,//节点编辑
            isGroup: false,

          }, {
            id: 11,
            label: '其他食品',
            isEdit: false,//节点编辑
            isGroup: false,

          },
          {
            id: 12,
            label: '零食',
            isEdit: false,//节点编辑
            isGroup: false,

          }]
        },
        {
          id: 9527,//未分组组别 id固定 或固定其他字段标识
          label: '用品',
          isEdit: false,//节点编辑
          isGroup: true,
          children: [{
            id: 5564564564656,
            label: '小宠用品',
            isEdit: false,//节点编辑
            isGroup: false,

          }, {
            id: 67897897,
            label: '其他用品',
            isEdit: false,//节点编辑
            isGroup: false,

          }]
        }
      ],
      defaultProps: {
        children: 'children',
        label: 'label'
      },
      suppLiserList: [],//供应商下拉列表
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 商品信息表格数据
      prodInfoList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        name: null,
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
      },
      id: null
    };
  },
  created() {
    this.getList();
    this.getClassList()//获取分类--子分类二位数组
    this.getSupplierList()//获取供应商下拉列表
  },
  watch: {
    filterText(val) {
      this.$refs.treeDom.filter(val);
    }
  },
  methods: {
    //获取供应商下拉列表
    getSupplierList() {
      supplierSelectList().then(res => {
        if (res.code == 200) {
          this.suppLiserList = res.data
        }
      })
    },
    // 全部分类---未分来
    changeSort(val) {
      this.sort = val
    },
    //当页全选
    checkedAll(rows) {
      if (rows) {
        rows.forEach(row => {
          this.$refs.multipleTable.toggleRowSelection(row);
        });
      } else {
        this.$refs.multipleTable.clearSelection();
      }
    },
    //获取分类--子分类二位数组
    getClassList() {
      getClassList().then(res => {
        if (res.code == 200) {
          var data = res.data
          data.forEach(item => {
            item.isEdit = false
            item.isGroup = true
            item.label = item.name
            if (item.list) {
              item.children = []
              item.list.forEach(ele => {
                ele.isEdit = false
                ele.isGroup = true
                ele.label = ele.name
              })
              item.children = item.list
            }
          })
          this.treeObjdata = data
        }
      })
    },
    // 下拉菜单
    handleCommand(command) {
      if (command == 10) {
        if (this.ids.length < 1) {
          this.$message({
            message: '至少勾选一个',
            type: 'warning'
          });
        }else{
          this.handleDelete(command)
        }
      }
    },
    //新建分类
    addSort() {
      this.sortDialogVisible = true
    },
    //新增商品
    addProd() {
      this.$router.push({ path: '/goods/addProd', query: {} })
    },
    filterTreeNode(value, data) {
      if (!value) return true;
      return data.label.indexOf(value) !== -1;
    },
    treeNodeClick(data, node) {
      console.log("tree cilck", data, node)
      console.log(node.level)
    },
    //提交新增分类
    submitClass() {
      addClassInfo({ pid: 0, name: this.sortForm.name }).then(res => {
        if (res.code == 200) {
          this.$message({
            message: '新增成功！',
            type: 'success'
          });
          this.getClassList()
          this.sortDialogVisible = false
        }
      })

    },
    //S tree node 新增删除修改
    addGroupTree(data) {
      if (!data.children) {
        this.$set(data, 'children', []);
      }
      let label = '新建分组' + (data.children.length + 1)
      const newChild = { id: new Date().getTime(), label: label, isEdit: false, isGroup: true, children: [] };
      data.children.push(newChild);
      addClassInfo({ pid: data.id, name: label }).then(res => {
        if (res.code == 200) {
          this.$message({
            message: '新增成功！',
            type: 'success'
          });
        }
      })
    },
    editGroupTree(data, node) {
      this.editNodeVal = data.label + ''
      data.isEdit = true
      this.ishaveEdit = true
      this.id = data.id
    },
    eidtClass() {
      updateClass({ id: this.id, name: this.editNodeVal }).then(res => {
        if (res.code == 200) {
          this.getClassList()
        }
      })
    },
    editTreeNodeSave(data, node) {
      data.label = this.editNodeVal
      data.isEdit = false
      this.ishaveEdit = false
    },
    editTreeNodeCancel(data, node) {
      data.isEdit = false
      this.ishaveEdit = false
    },

    removeGroupTree(data, node) {
      console.log("remove-----", data, node)
      const parent = node.parent;
      const children = parent.data.children || parent.data;
      const index = children.findIndex(d => d.id === data.id);
      children.splice(index, 1);
      delClass(data.id).then(res => {
        if (res.code == 200) {
          this.$message({
            message: '删除成功！',
            type: 'success'
          });
        }
      })
    },

    // 新建分组
    addFirstTreeNode() {

      let oindex = this.treeObjdata.length - 1
      let label = '新建分组' + this.treeObjdata.length
      const newChild = { id: new Date().getTime(), label: label, isEdit: false, isGroup: true, children: [] };
      this.treeObjdata.splice(oindex, 0, newChild)

      console.log("添加一级分组", this.treeObjdata)
    },

    //E tree node 新增删除修改
    handleDragStart(node, ev) {
      console.log('drag start', node);
    },
    handleDragEnter(draggingNode, dropNode, ev) {
      console.log('tree drag enter: ', dropNode.label);
    },
    handleDragLeave(draggingNode, dropNode, ev) {
      console.log('tree drag leave: ', dropNode.label);
    },
    handleDragOver(draggingNode, dropNode, ev) {
      console.log('tree drag over: ', dropNode.label);
    },
    handleDragEnd(draggingNode, dropNode, dropType, ev) {
      console.log('tree drag end: ', dropNode, dropType);
    },
    handleDrop(draggingNode, dropNode, dropType, ev) {
      console.log('tree drop: ', dropNode.label, dropType);
      console.log("最终数据", this.data)
    },

    allowDrop(draggingNode, dropNode, type) {
      console.log("拖拽放置===", draggingNode.data.isGroup, dropNode, type)
      // 判断拖拽目标是否可以被放置到子节点
      if (!draggingNode.data.isGroup) {
        if (dropNode.level == 1) {
          return type === 'inner';
        } else {
          return type !== 'inner';
        }
      } else {
        // 判断是否是未分组
        if (dropNode.level == 1) {
          if (dropNode.data.id == '9527') {
            return type === 'prev';
          } else {
            return true;
          }
        } else {
          // 判断父级是否是未分组
          if (dropNode.parent.data.id == '9527') {
            return false
          } else {
            return true;
          }
        }
      }
    },
    allowDrag(draggingNode) {
      console.log("允许拖拽", draggingNode)
      return draggingNode.data.id != '9527';
      //   return true
    },
    // tab切换
    changeTab(value) {
      this.tab = value
    },
    /** 查询商品信息列表 */
    getList() {
      this.loading = true;
      listProdInfo(this.queryParams).then(response => {
        this.prodInfoList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        no: null,
        name: null,
        topCate: null,
        sedCate: null,
        brand: null,
        suitPetType: null,
        datProdInfocol: null,
        sellByDate: null,
        barCode: null,
        spetModel: null,
        unit: null,
        buyPrice: null,
        retPrice: null,
        memPrice: null,
        isNoModel: null,
        alert: null,
        isDisMem: null,
        isPrchRem: null,
        updateUser: null,
        updateTime: null,
        createUser: null,
        createTime: null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length !== 1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加商品信息";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.$router.push({ path: '/goods/addProd', query: { id: row.id } })
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.id != null) {
            updateProdInfo(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addProdInfo(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal.confirm('是否确认删除商品信息编号为"' + ids + '"的数据项？').then(function () {
        return delProdInfo(ids);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => { });
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('pet/prodInfo/export', {
        ...this.queryParams
      }, `prodInfo_${new Date().getTime()}.xlsx`)
    }
  }
};
</script>
<style lang="scss" scoped>
.prodInfo {
  .box {
    .left {
      width: 202px;
      border-radius: 12px;
      border: 1px solid #ecebed;

      .tree-head {
        padding: 15px 0 15px 10px;
        border-bottom: 1px solid #ecebed;
      }

      .tree-sort {
        div {
          height: 76px;
          line-height: 76px;
          padding-left: 40px;
          box-sizing: border-box;
          width: 100%;
          position: relative;
          color: #333336;
        }

        div:hover {
          background: #F9F9F9 !important;
          cursor: pointer;
        }

        div.active {
          background: #FFFCE6;
        }
      }
    }

    .right {
      width: calc(100% - 202px);
      padding-left: 20px;
      box-sizing: border-box;

      .table-foot {
        margin-top: 10px;

        .el-checkbox {
          margin-right: 10px;
        }

        .el-select {
          margin-left: 20px;
        }
      }
    }
  }
}
</style>
<style lang="scss" scoped>
@mixin tree-font-color-size {
  color: #333333;
  font-size: 14px;
}

.overflow-y-auto {
  overflow-y: auto;

  &::-webkit-scrollbar {
    width: 6px !important;
    height: 6px !important;
  }

  &::-webkit-scrollbar-track {
    background: transparent !important;
    border-radius: 2px !important;
  }

  &::-webkit-scrollbar-thumb {
    background: transparent !important;
    border-radius: 6px !important;
  }

  &::-webkit-scrollbar-thumb:hover {
    background: transparent !important;
  }

  &:hover::-webkit-scrollbar-thumb {
    background: yellow !important;
    border-radius: 6px !important;
  }

  &:hover::-webkit-scrollbar-thumb:hover {
    background: yellow !important;
  }

  &::-webkit-scrollbar-corner {
    background: transparent !important;
  }
}

.tree-list-box {
  width: 100%;
  height: 100%;
}

.search-box {
  width: 100%;
  height: 36px;
  border: 1px solid #d7e0ef;
  border-radius: 4px;
  box-sizing: border-box;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fff;

  .el-input {
    width: calc(100% - 30px);
    color: #abafb4;
    font-size: 14px;

    ::v-deep .el-input__inner {
      border: none;
      height: 34px;
      line-height: 34px;
      background-color: transparent;
    }
  }

  .search-ico {
    width: 30px;
    height: 30px;
    line-height: 30px;
    text-align: center;
    color: #abafb4;
    font-size: 16px;
    cursor: pointer;

    &:hover {
      color: #666;
    }
  }
}

.tree-content {
  width: 100%;
  height: calc(100% - 36px - 20px);
  box-sizing: border-box;

  .tree-all-box {
    width: 100%;
    height: 30px;
    line-height: 30px;
    text-align: left;
    padding: 0 10px;
    box-sizing: border-box;
    cursor: pointer;
    @include tree-font-color-size;
  }

  .is-tree-all {
    background: #f5f7fa;
  }
}

.add-tree-node {
  width: 100%;
  padding: 20px 0 10px;
  display: flex;
  justify-content: flex-start;
  background: #fff;
  position: sticky;
  bottom: 0;
}

// S tree custom style
.el--tree-dom {
  width: 100%;
  padding-bottom: 50px;

  .el-tree-node__content {
    height: 76px !important;
  }

  .el-tree-node__expand-icon {
    color: #85888e;
    font-size: 14px;
  }

  .el-tree-node__expand-icon.is-leaf {
    color: transparent;
  }

  .custom-tree-node {
    width: calc(100% - 26px);
    height: 30px;

    .custom-show-data {
      width: 100%;
      height: 100%;
      display: flex;
      justify-content: space-between;
      align-items: center;
      @include tree-font-color-size;

      .custom-node-label {
        width: calc(100% - 70px);
        text-align: left;
        cursor: move;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
      }

      //  设备label
      .no-group-label {
        width: calc(100% - 30px);
      }

      .cust-label-oper {
        width: 70px;
        display: none;
        align-items: center;
        justify-content: space-around;

        i {
          font-size: 16px;
          color: #666;

          &:hover {
            color: #2f77f1;
          }
        }
      }

      &:hover {
        .cust-label-oper {
          display: flex;
        }
      }

      .custom-location {
        width: 28px;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;

        .device-online {
          color: #2f77f1;
        }

        .device-unonline {
          color: #d81e06;
        }
      }
    }

    .custom-edit-node {
      width: 100%;
      height: 100%;
      display: flex;
      justify-content: space-between;
      align-items: center;

      .custon-edit-input {
        width: calc(100% - 70px);
        height: 26px;
        border: 1px solid #d7e0ef;
        padding: 0 5px;
        box-sizing: border-box;

        &:focus-visible {
          outline: #1989fa solid 1px;
        }

        &::placeholder {
          color: #ccc;
        }
      }

      .custon-edit-ico {
        width: 70px;
        padding: 0 12px;
        display: flex;
        align-items: center;
        justify-content: space-between;

        i {
          font-size: 16px;
          color: #666;

          &:hover {
            color: #2f77f1;
          }
        }
      }
    }
  }
}
</style>
